package org.finesys.common.disruptor.hooks;

import com.lmax.disruptor.RingBuffer;
import com.lmax.disruptor.Sequence;
import org.finesys.common.disruptor.event.DisruptorEvent;

public class RingBufferShutdownHook extends Thread {

    private RingBuffer<DisruptorEvent> ringBuffer;

    private Sequence sequence;

    public RingBufferShutdownHook(RingBuffer<DisruptorEvent> ringBuffer, Sequence sequence) {
        this.ringBuffer = ringBuffer;
        this.sequence = sequence;
    }

    @Override
    public void run() {
        ringBuffer.removeGatingSequence(sequence);
    }

}